package com.piece.module.generator.service;

import com.piece.core.jpa.repository.BaseService;
import com.piece.module.generator.model.GenTableColumn;
import com.piece.module.generator.repository.GenTableColumnRepository;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

@Service
public class GenTableColumnService extends BaseService<GenTableColumn, String> {

    @Resource
    private GenTableColumnRepository genTableColumnRepository;

    @PostConstruct
    public void initRepository() {
        setRepository(genTableColumnRepository);
    }

    public List<GenTableColumn> findByTableId(long tableId) {
        HashMap<String, Object> param = new HashMap<>();
        param.put("tableId", tableId);
        return findByCondition(param);
    }
}
